<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <base href="${basePath }" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="3rd/ligerui/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css"/>
    <script src="3rd/ligerui/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="3rd/ligerui/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="3rd/jscolor/jscolor.js"></script>
    <script src="3rd/ligerui/jquery-validation/jquery.validate.min.js" type="text/javascript"></script>
    <script src="3rd/ligerui/jquery-validation/jquery.metadata.js" type="text/javascript"></script>
    <script src="3rd/ligerui/jquery-validation/messages_cn.js" type="text/javascript"></script>
    <script type="text/javascript">
        var openWin,i=1;

        $(function (){



            //创建表单结构
            $("#publist").ligerDateEditor({ showTime: true});

            $("form").ligerForm();
            $('#selectArt').click(function(){
                openWin = $.ligerDialog.open({ url: '${basePath }text/list.shtml', height: 500,width: 800 });
            });

            $.metadata.setType("attr", "validate");
            $("form").validate({
                errorPlacement: function (lable, element)
                {
                    if (element.hasClass("l-textarea"))
                    {
                        element.ligerTip({ content: lable.html(), target: element[0] });
                    }
                    else if (element.hasClass("l-text-field"))
                    {
                        element.parent().ligerTip({ content: lable.html(), target: element[0] });
                    }
                    else
                    {
                        lable.appendTo(element.parents("td:first").next("td"));
                    }
                },
                success: function (lable)
                {
                    lable.ligerHideTip();
                    lable.remove();
                },
                submitHandler: function ()
                {
                    $("form .l-text,.l-textarea").ligerHideTip();
                    document.form1.submit();
                }
            });

            $('#filediv input:checkbox').live('click',function(){
                $(this).next().next().remove();
                $(this).next().remove();
                $(this).remove();
            });
        });

        function getSel(rows){
            for(var i in rows){
                $('#selSpan').append('<input name="artids" type="checkbox" checked="checked" value="'+rows[i].id+'" />'+rows[i].title);
                openWin.close();
            }
        }

        function addMoreImg(){
            $('#filediv').append('<input type="checkbox" checked="checked"  /><input type="file" name="pics"  /><br/>');
        }

    </script>
</head>
<body style="padding: 10px">
  <form method="post" action="image/save.shtml" name="form1" enctype="multipart/form-data">
      <table id="formTable" cellpadding="0" cellspacing="0" class="l-table-edit" >
          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">文章所属模型:</td>
              <td align="left" class="l-table-edit-td">
                  图集模型
                  <input type="hidden" value="I" name="type" />
              </td>
          </tr>
          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">推荐位:</td>
              <td align="left" class="l-table-edit-td">
                  <c:forEach items="${recommends}" var="entry">
                      <input value="${entry.key}" name="recommend" type="checkbox" >${entry.value}&nbsp;&nbsp;
                  </c:forEach>
              </td>
          </tr>

          <tr style="line-height: 30px;">
            <td align="right" class="l-table-edit-td">栏目:</td>
            <td align="left" class="l-table-edit-td">
                 <select name="part">
                      <option value="">请选择</option>
                      <c:forEach items="${parts}" var="entry">
                          <option value="${entry.key}" <c:if test="${entry.key eq data.part}">selected="selected" </c:if>  >${entry.value}</option>
                      </c:forEach>
                  </select>
            </td>
          </tr>
          <tr style="line-height: 30px;">
          <td align="right" class="l-table-edit-td">文章排序:</td>
              <td align="left" class="l-table-edit-td">
                 <input name="sort" value="0" validate="{digits:true,min:0}" value="${data.sort}" />
              </td>
          </tr>
          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">标题:&nbsp;</td>
              <td align="left" class="l-table-edit-td">
                  <input name="title" validate="{required:true}" ${data.title} />
              </td>
          </tr>
          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">简略标题:&nbsp;</td>
              <td align="left" class="l-table-edit-td">
                  <input name="brieftitle" value="${data.brieftitle}" />
              </td>
          </tr>
          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">标题颜色:&nbsp;</td>
              <td align="left" class="l-table-edit-td">
                  <input class="color" value="${data.titlecolor}" name="titlecolor" />
              </td>
          </tr>
          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">加粗:&nbsp;</td>
              <td align="left" class="l-table-edit-td">
                  <input name="titlestyle" type="checkbox" value="bold" <c:if test="${data.titlestyle=='bold'}">checked="checked"</c:if> />
              </td>
          </tr>
          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">作者:&nbsp;</td>
              <td align="left" class="l-table-edit-td">
                  <input name="author" validate="{required:true}" value="${data.author}" />
              </td>
          </tr>
          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">来源:&nbsp;</td>
              <td align="left" class="l-table-edit-td">
                  <input name="source" validate="{required:true}" value="${data.source}" />
              </td>
          </tr>
          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">跳转网址:&nbsp;</td>
              <td align="left" class="l-table-edit-td">
                  <input name="clickgourl" value="${data.clickgourl}"/>
              </td>
          </tr>
          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">相关文章:&nbsp;</td>
              <td align="left" class="l-table-edit-td">
                  <a href="javascript:void(0)" id="selectArt" >选择</a>
                  <span id="selSpan"></span>
              </td>
          </tr>
          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">发布时间:</td>
              <td align="left" class="l-table-edit-td">
                  <input type="text" name="publist" id="publist" value="${data.publist}" readonly />
              </td>
          </tr>
          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">关键词:</td>
              <td align="left" class="l-table-edit-td">
                  <input type="text" name="keyword" value="${data.keyword}" />
              </td>
          </tr>
          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">摘要;</td>
              <td align="left" class="l-table-edit-td">
                  <textarea style="width:400px;height:150px;" id='summary' name="summary">${data.summary}</textarea>
              </td>
          </tr>

          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">缩略图:</td>
              <td align="left" class="l-table-edit-td">
                  <input type="file" name="smallPic" />
              </td>
          </tr>

          <tr style="line-height: 30px;">
              <td align="right" class="l-table-edit-td">图片:</td>
              <td align="left" class="l-table-edit-td">
                  <a href="javascript:void(0)" onclick="addMoreImg()">添加更多</a>
                  <div id="filediv">
                      <input type="file" name="pics" /><br/>
                  </div>
              </td>
          </tr>

          <tr style="line-height: 30px;">
              <td class="l-table-edit-td"><input type="submit" value="保存" class="l-button l-button-submit"  /></td>
          </tr>
         </table>
  </form>
</body>
</html>